var express = require('express');
var router = express.Router();
const fs = require('fs')
const path = require('path')

/* GET home page. */
router.get('/', function (req, res, next) {
  res.render('index', {
    title: '啊这', age: '20', el: '<del>998</del>',
    arr: ['吃饭', '睡觉', '写代码']
  });
});

router.get('/pic', (req, res) => {
  // console.log(path.resolve("assets/pic"));
  let readRes = fs.readdirSync(path.resolve("assets/pic"))
  // res.send('666')
  // readRes = readRes.filter((item, index) => {
  //   return index !== 0
  // })
  console.log(readRes);

  res.render("pic", { assetsPath: "/pic/", data: readRes })
})
module.exports = router;
